package
{
	import com.greensock.TweenLite;
	
	import flash.display.Sprite;
	
	public class SlideShow extends Sprite
	{
		public function SlideShow()
		{
			super();
			
			imageA = new Image();
			this.addChild( imageA );
			
			imageB = new Image();
			this.addChild( imageB );
			
			crtImage  = imageA;
		}
		
		private var imageA:Image;
		private var imageB:Image;
		
		private var crtImage:Image;
		
		public function switchImage(url:String):void{
			// 当前图片消失
			TweenLite.to( crtImage, 0.8, { alpha:0});
			// 非当前图片切换为当前图片
			if( crtImage == imageA )
				crtImage = imageB;
			else crtImage = imageA;
			
						
			crtImage.alpha = 0;
			crtImage.loadImage( url );
			
			setChildIndex(crtImage,numChildren - 1 ); 
			
			TweenLite.to( crtImage, 0.8, { alpha:1});
		}
	}
}